from rest_framework import viewsets
from comment.models import Comment
from comment.serializers import CommentSerializer
from comment.permissions import IsOwerOrReadOnly

# Create your views here.
class CommentViewSet(viewsets.ModelViewSet):
  queryset = Comment.objects.all()
  serializer_class = CommentSerializer
  permission_classes = [IsOwerOrReadOnly]

  def perform_create(self, serializer):
    serializer.save(author=self.request.user, modifier=self.request.user)
  
  # def perform_update(self, serializer):
  #   serializer.update(modifier=self.request.user)
